package com.report.dto.response;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author summer
 * @date 2024-06-27 19:51
 */
@Data
@SearchBean(tables = " `member_order` o  LEFT JOIN `member_rule` r ON o.member_rule=r.id" +
        " LEFT JOIN `research_member` m ON o.member_id=m.id ",autoMapTo = "o",orderBy = "o.create_time DESC")
public class OrderRes implements Serializable {

    @DbField("o.id")
    private Integer id;

    @DbField("o.member_id")
    private Integer memberId;

    @DbField("m.nickName")
    private String name;

    @DbField("m.phone")
    private String phone;

    @DbField("m.idNum")
    private String idNum;

    @DbField("o.order_num")
    private String orderNum;

    @DbField("o.order_price")
    private BigDecimal orderPrice;

    @DbField("o.member_rule")
    private Integer memberRule;

    @DbField("r.name")
    private String ruleName;

    @DbField("CASE WHEN r.vip=90 THEN '三个月' WHEN r.vip=365 THEN '一年' END")
    private String vipName;

    /**
     * 1微信2支付宝
     */
    @DbField("o.pay_method")
    private Integer payMethod;

    @DbField("(CASE WHEN o.pay_method THEN '微信' ELSE '支付宝' END)")
    private String payMethodName;

    @DbField("o.order_status")
    private Integer orderStatus;

    @DbField("CASE WHEN o.order_status=1 THEN '待支付' ELSE '已支付' END ")
    private String statusName;


    /**
     * 1pc 2小程序
     */
    @DbField("o.pay_plat")
    private Integer payPlat;

    @DbField("(CASE WHEN o.pay_plat THEN 'PC' ELSE '小程序' END)")
    private String payPlatName;

    @DbField("o.create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;
}
